﻿namespace AiFrame.InterfaceLib.Plugins
{
    /// <summary>
    /// Represents a factory manager to exchange factories
    /// among plugins.
    /// </summary>
    public interface IFactoryManager
    {
        /// <summary>
        /// Registers a new factory.
        /// </summary>
        /// <param name="factory">The factory.</param>
        void RegisterFactory(IFactory factory);

        /// <summary>
        /// Unregisters a factory.
        /// </summary>
        /// <param name="factory">The factory.</param>
        void UnregisterFactory(IFactory factory);

        /// <summary>
        /// Resolves a factory with the given type and returns it.
        /// </summary>
        /// <typeparam name="T">Type of the factory.</typeparam>
        /// <returns>The factory. If not factory found, NULL.</returns>
        T GetFactory<T>();
    }
}
